package com.kk.license.starter.config;

import com.kk.license.starter.interceptor.LicenseCheckInterceptor;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;

/**
 * @author wangkang
 * @version 1.0
 * @description 配置拦截器，用于验证证书
 * @create 2023-07-17 10:17
 */
@Component
public class LicenseInterceptorConfig implements WebMvcConfigurer {
    @Resource
    private LicenseCheckInterceptor licenseCheckInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {

        // 添加要拦截的url
        registry.addInterceptor(licenseCheckInterceptor)
                // 拦截的路径
                .addPathPatterns("/**/login/**");
    }
}
